﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace BlogApi.Models
{
    /// <summary>
    /// 文章表
    /// </summary>
    public class Article:BaseEntity
    {
        /// <summary>
        /// 文章标题
        /// </summary>
        [Required]
        public string Title { get; set; }
        /// <summary>
        /// 文章内容markDown的格式的
        /// </summary>
        [Required,Column(TypeName ="ntext")]
        public string Content { get; set; }
        /// <summary>
        /// 写了这篇文章的用户ID
        /// </summary>
        [ForeignKey(nameof(User))]
        public Guid UserId { get; set; }
        public User User { get; set; }
        /// <summary>
        /// 这篇文章的点赞数量
        /// </summary>
        public int GoodNumber { get; set; }
        /// <summary>
        /// 评论量
        /// </summary>
        public int CommentNumber { get; set; }
        /// <summary>
        /// 浏览量
        /// </summary>
        public int BrowseNumber { get; set; }
        /// <summary>
        /// 文章状态
        /// </summary>
        public string Status { get; set; } = "notPublished";
        /// <summary>
        /// 文章发布的时间
        /// </summary>
        public DateTime PublishedDate { get; set; }
    }
}
